properly emit events