Fixed permission check.