fix bugs in LAOF.cpp EM()