added ids to event output and fixed a bug