fix bugs with UnitTesting