take variable from global to function