fix ref counting issue and peermode on restored permanent bindings