Fixed issue #255 and #258.