bugfix scope variable vs global scope varible