Use handleEventTimeout instead of handleEvent and improve error handling