Wrong reference to variable