fix cleanup pointers