Destroy ref markers before parse, and create ref markers after parse