fixing permissions check