Added better behavior for disconnections.