corrected var used twice