[tor-commits] [tor/master] Fix some #5040 bugs found by Nick's tests.