Xbee.h returning incorrect ADC values

I am trying to modify the tweet-a-watt project and push the data to pachube with an Ethernet shield instead of sending to twitter from my PC. I'm having some trouble reading the analog inputs 0 and 4 (volts and amps). I have the xbee Tx is setup just like the Tweet-A-Watt project calls for:
MY=1, SM=4, ST=3, SP=C8, D4=2, D0=2, IT=13, IR=1

I'm basically using the XBee_Test_IOSamples sketch that comes with Xbee.h library to read the data. When I read xbee analog inputs, I get this:
Volts = ( 163.00 211.00 322.00 489.00 650.00 766.00 826.00 837.00 785.00 665.00 493.00 335.00 224.00 172.00 164.00 226.00 351.00 524.00 679.00 )
Current = ( 322.00 489.00 650.00 766.00 826.00 837.00 785.00 665.00 493.00 335.00 224.00 172.00 164.00 226.00 351.00 524.00 679.00 0.00 0.00 )

You'll notice that the current values are the same as the voltage values, just shifted two spots to the left. Anyone know what I am doing wrong?

Here's my sketch:

#include <XBee.h>
XBee xbee = XBee();
Rx16IoSampleResponse ioSample = Rx16IoSampleResponse();

void setup() {
  xbee.begin(9600);
}

void loop() {
  float volts[19];
  float current[19];
 
  //attempt to read a packet
  xbee.readPacket();

  if (xbee.getResponse().isAvailable()) {
    // got something

    if (xbee.getResponse().getApiId() == RX_16_IO_RESPONSE) {
      xbee.getResponse().getRx16IoSampleResponse(ioSample);

      Serial.print("Received I/O Sample from: ");
      Serial.println(ioSample.getRemoteAddress16(), HEX);

      Serial.print("Sample size is ");
      Serial.println(ioSample.getSampleSize(), DEC);

      for (int k = 0; k < ioSample.getSampleSize(); k++) {
          volts[k] = ioSample.getAnalog(0, k);
          current[k] = ioSample.getAnalog(4, k);
      }
     
      // Print array with voltage and current ADC values from Xbee
      Serial.print("Volts =   ( ");
      for (int i = 0; i < samples; i++) {
          Serial.print(volts[i]);
          Serial.print(" ");
      }
      Serial.println(" )");
      Serial.print("Current = ( ");
      for (int i = 0; i < samples; i++) {
          Serial.print(current[i]);
          Serial.print(" ");
      }
      Serial.println(" )");
     
    }
    else {
      Serial.print("Expected I/O Sample, but got ");
      Serial.print(xbee.getResponse().getApiId(), HEX);
    }
  }
  else if (xbee.getResponse().isError()) {
    Serial.print("Error reading packet. Error code: ");
    Serial.println(xbee.getResponse().getErrorCode());
  }
}

Where is samples defined? Where is it assigned a value?

It looks like you are reading the number of samples from the packet, and then printing a fixed number of values, and that the number of samples and the fixed number of values do not match.

Sample size is pulled from the xbee data using ioSample.getSampleSize()

Sample size is pulled from the xbee data using ioSample.getSampleSize()

Where?

      for (int i = 0; i < samples; i++) {
          Serial.print(volts[i]);
          Serial.print(" ");
      }

Show me where, in the code you posted, samples is declared, and where it is assigned a value.

I guess I made a mistake pasting the code to the forum. I was getting samples from ioSample.getSampleSize(). After this problem cropped up I decided to see what would happen with the Xbee_Test_IOSamples sketch that comes with xbee.h library. It shows the same problem. Here's the sketch

#include <XBee.h>
XBee xbee = XBee();

Rx16IoSampleResponse ioSample = Rx16IoSampleResponse();

void setup() {
  xbee.begin(9600);
}

void loop() {
  //attempt to read a packet
  xbee.readPacket();

  if (xbee.getResponse().isAvailable()) {
    // got something

    if (xbee.getResponse().getApiId() == RX_16_IO_RESPONSE) {
      xbee.getResponse().getRx16IoSampleResponse(ioSample);

      Serial.print("Received I/O Sample from: ");
      Serial.println(ioSample.getRemoteAddress16(), HEX);

      Serial.print("Sample size is ");
      Serial.println(ioSample.getSampleSize(), DEC);

      if (ioSample.containsAnalog()) {
        Serial.println("Sample contains analog data");
      }

      if (ioSample.containsDigital()) {
        Serial.println("Sample contains digital data");
      }

      for (int k = 0; k < ioSample.getSampleSize(); k++) {
        Serial.print("Sample ");
        Serial.print(k + 1, DEC);
        Serial.println(":");

        for (int i = 0; i <= 5; i++) {
          if (ioSample.isAnalogEnabled(i)) {
            Serial.print("Analog (AI");
            Serial.print(i, DEC);
            Serial.print(") is ");
            Serial.println(ioSample.getAnalog(i, k));
          }
        }

        for (int j = 0; j <= 8; j++) {
          if (ioSample.isDigitalEnabled(j) && ioSample.containsDigital()) {
            Serial.print("Digital (DI");
            Serial.print(j, DEC);
            Serial.print(") is ");
            Serial.println(ioSample.isDigitalOn(j, k));
          }
        }
      } 
    } 
      
    else {
      Serial.print("Expected I/O Sample, but got ");
      Serial.print(xbee.getResponse().getApiId(), HEX);
    }
  }
  else if (xbee.getResponse().isError()) {
    Serial.print("Error reading packet. Error code: ");
    Serial.println(xbee.getResponse().getErrorCode());
  }
}