Fix compile errors and support null scopes to use nearest.any for normal.
Add license headers.