another fix for global vars, may work...