fixes issues #2840 #2852
Merge pull request #2864 from FinalAngel/develop

fixes issues #2840 #2852