Validation fixes

Fixes #142.