fixed Issue #866 and #455