Fix improperly placed var statement