I had to do several small changes to emx sources, I've included them here.
