Fixed a bug in the unit tests and a typo