Fix permission check