fixed auto ref for each