Add sanity checks to automatic result unmarshalling