fix keepalive mechanism