fixed a bug in events