added $tries in function globals