fix a number of small stuff that happens when loading very old data files (like 572).
remove static return variable from escape_string. add test coverage.