Avoid referencing invalidated pointers.