Fix issue #207 and add a test.