fixing incorrect variable ref