Fix keepAlive behavior