error on keepalive failing were not retried fast enough as the code was in the wrong location