correct error messages
improved exception handling