fixed the bugs in unit testing