Fixed most of the unit tests