fixed use of wrong variable