fix some error potential and use getOperation on the event object