tests and minor improvements for the errors