fix #858

fix #858 
I cost about 6 hours to fix this issue,I fix two bugs in the plugin.