changed decoding so that it stops when characters are not in regular ASCII range.