the mex constructor works without crashing matlab now