Make equals and hashCode null schema safe

Fixes #918