Improve validation errors for modals

Fixes #604