Fixed protected ptr free issue.