Added test case and fix for issue 114