MRELEASE-740 fix a few problens on Windows thanks to Florent Paillard for the patch. Applied with slight changes.