fixed some problems when disconnecting + more

there was a problem when releasing memory, so now we get more debugging
here