Don't copy cached indexes
Remove calls to deepcopy in Ref and in get_text