fixes to use env.gateway and moved get_pillar