Bug fix of variable scope overlap