add debug and text formats
fix text case substitutions