fixed querying permissions