Fix issue #198 and add test.