added test cases and fixed breaking