added new tests and error codes