properly handle disconnect callback to prevent unknown 106 error