replace-regex and format fixes