Fixed small merge error, and small bugs in the event creation.