change var to ref, and let to var