new marshalling/demarshalling code had a few bugs.  this fixes them