improve stability

* memory leaks