fix issue #83 and #98