more memory leak fixing