Updated event handling logic for ioGetNextEvent()