Fixed up error reporting so that I can track down more issues!
fixed integer encoding/decoding bug, added debugging output.