fixing wrong var used