Fix bugs in eunit test cases