Fixed most bugs with new Emit functions