improved roundtripping script