fixed bug in disconnect