fix #894,partly fix #891