fixed the bug

added unit test case