small fixes in mex wrapper