fix error on disconnect