Fix issue #372 and add test case.