Fix issue 25

Fix for issue 25 plus related test case.