add keepalive logic