switch to ems and fix errors