fixed most of the test cases