Fix heavy bug which caused to stop decoding process on the middle of the file when strange pattern occurred.