Fixes of some memory leaks