fixed error messages and tests

I fixed the problems for real this time.