Re-fixing the bug with an added test case.