updated permissions check