Fix for issue #2

I added a test case included in this fix.