more mem leak fixes