this is necessary to clean up the pointer list correctly, see line 483