Better error message

Closes #526