fixed error reporting bug