fixed errors found during unit test