Fixed annoying global vs local problem