Fix max_fd calculation in event_loop_once