Better null handling in MappingVisitor

Closes #1068