You don't need the surrounding brackets, and if you could properly space 
core.localUnits~=nil)then 
into 
core.localUnits ~= nil then
I'd appreciate it.