Fix if statement in getloop