Various fixes to EM for the new sunlight gem

Fixes #524