Fix validation

- fixed validation that broke when introducing error classes
- added a test