fixed select/timeval bug in event api