Additional test case and fixed code