fixed tests
fixed carriage return handling (not perfect but good enough most of the time)