Fixed a bug leading to an event getting fired all the time