added more errors and unit tests