You query for customers 100 at a time and you have 101 customers in QB. On the first handle_response call, r['customer_ret'] will be an array of 100 customers. On the second call, it will be a hash of a single customer. This sucks to handle - it should always be an array.