Some bugs in the test cases fixed.