corrected logic for test case