fixed scope of local variables & double definitions

bug: local variables with equal names were not created. Instead references to the outter local are used.
Same for double definitions.

example:
local a=1   --  <- ref=2
function b()
  local a=2  --  <- not created
end

local a=1   --  <- ref=2
local a=2  --  <- not created
fixed linux compability