Fix init EMR code