fix #1186 should also take care of #1185
Merge pull request #1187 from belforte/master

fix #1186 should also take care of #1185