fix empty events array bug