Fix and test case for bug #20