Fixed keep-alive bugs.