global vars problem solved