Fixes to bugs highlighted by round trip testing