fixing bug in creating events