Fix and test case for bug #17