more memleak fixes