fixed issue #620, #631, #632, #633