fixed a crash if more than one reference was used