Improved error messages

Ticket 437