fixed bug in set_global method