#6165: move cleanString to utils, minor error logging update