Fix error message reporting. Fixes #35