Handle NameError by setting model to nil on validation

Fixes #21