Avoid alteration of functional structures by etching