Some fixes for timed-out connections