fixes bugs in test cases