Some bugfixes related to Connection: keep-alive functionality