issue #46 and #50 fix