Fix and test #247, #242