fixed marshalling in certain cases