Fix for wrong decoding of count in rle and infinite loop