Fixes a bug with global variables assigned in subs and functions