Handle disconnections better