fixing a bug in the SW marshalling code