Fix the handling of locals