fixed issue #28, #29, #30