nil check fixes for EMS
minor tweaks