Attempt at fixing bug 3186
Merge pull request #1464 from StevenPuttemans:bugfix_3186_second