fixed galleries permission check