It seems this setting needs to be there from the beginning of the session, I tried first to do `export TERM=xterm` but then scrolling through history on the console still garbled the output, after adding `TERM=xterm` to `.bashrc` and logging back in it seemed to work very nicely.