process \r correctly