Fix scope of variable