made errors more readable, fixed error reporting bug