added two unit tests, fixed errors