fix #1128 and #1124
Merge pull request #1129 from Soul1355/master

fix #1128 and #1124