Added test case and possible fix for issue #5