Fixed a bug in events.lua.