fixing bug 3777
Merge pull request #2985 from StevenPuttemans:fix_3777_redo