Rework the EmitCallback contract. Fix some bugs.