fixes issue #2576
Merge pull request #2719 from FinalAngel/fixes/2576

fixes issue #2576
fixes issue #2718