Possible fix for #630, need to verify on Mac and Linux (no problems on windows so far)