Refer local vairable correctly