fixes to get mex working on windows