parallel ema bug fix related to logging and rewrite of 
write_prim_to_std_out