Modify max error calculation in moecalc()