More fixes to iteration and cURL

Fixed all checks in all cURL calls to reflect what the array var is
called.  Many fixes to iteration, including a fix to an edge case where
a single return could be dropped from the array of data and fixed a case
where a user level error could be thrown if the while loop was skipped
in iteration.