Fixed bug in EMF generator