Permissions checking improved