detectMex.cpp seems ok