Fix bug with empty events object