Merge "Fix use-after-free"