added test cases for bugs found