fixing variable ref