Fixed permission checking