Fixed use of wrong variable