Modify to work with cygwin/mintty/screen