fix #1169 and #1170
Merge pull request #1230 from chrox/fix_1170

fix #1169 and #1170