fixed permission handling