Fixing bug with event  uninitialized