Try hard not to break delete_path_obj()

Safely fixes issue #3274