added missing 'var' to local variable declaration