Few bug fixes to EM