save fixes ported from tresql