fixed issue #477, #409