fixed the unit test code and other small codes