fix permission generation