Fixing permissions handling