Fix for issue #19 plus test case for it.