fix incorrect way of checking events