recover from memory leaks