Fixed keepalive bug