Fix on the emit function