fix #899 #948 #788
Merge pull request #949 from belforte/master

fix #899 #948 #788