more mex plus minor bugfixes