Reimplement the timeout operator and fix timeout bugs