Fix and test #247, #242
Fix and test #247, #242
minor changes