Fixed bug in event creation.