Added possible fix for device disconnection and keepalive