this isn't defined anywhere ? I think your localmode change is bleeding in.