fix deletion of pointers