It was refering to the wrong variable