referencing incorrect variable