fixed issue #29 and #30