take gloval variable from global to function