Change getloop to exit if curl fails