fix windows build (needed the MEX_ variables set in local scope as well as parent scope)