Fixed bugs in MEP and MFD