referenced correct variable in last line