Fixed a bug which emitted the wrong id.