fix #864, fix #894,partly fix #891,fix wrong redeclare in different interfaces.

fix #864, fix #894,partly fix #891