fixed a bug that caused a closed valueArray not to be detected; don't cout on \r in strings;