local variable fix

( + a upper/lowercase fix for linux)

Bug examples:
local a=1   --  <- ref=2
function b()
  local a=2  --  <- not created
end

local d=1  --  <- ref=2
local d=2  --  <- not created