fix memleak
fix disconnect segv