Fixes #13 - bad error handling and error messages