Fix bug when timeout is None