Fixing some issues regarding firing events.