Fix permission check.