added some regression tests and updated error messages