Issue #247, add unit test