Error messages

Bugfixes #682, #605.