Fixing issues #248 and #247.