 
         /** triggered when demux has completed fragment parsing **/
         private function _fragParsingCompleteHandler() : void {
-            if (_cancel_load == true)
+            if (_loading_state == LOADING_IDLE)
                 return;
             var hlsError : HLSError;
-
-            // reset IO error, as if we reach this point, it means fragment has been successfully retrieved and demuxed
-            _frag_load_error = false;
-
             var fragData : FragmentData = _frag_current.data;
             if (!fragData.audio_found && !fragData.video_found) {
                 hlsError = new HLSError(HLSError.FRAGMENT_PARSING_ERROR, _frag_current.url, "error parsing fragment, no tag found");

                Log.error("I/O Error while loading key:" + message);
            }
            if (HLSSettings.keyLoadMaxRetry == -1 || _key_retry_count < HLSSettings.keyLoadMaxRetry) {
                _key_load_error = true;
                _key_load_error_date = new Date().valueOf() + _key_retry_timeout;
                CONFIG::LOGGING {
                    Log.warn("retry key load in " + _key_retry_timeout + " ms, count=" + _key_retry_count);

                        }
                        if (last_seqnum == Number.NEGATIVE_INFINITY) {
                            // playlist not yet received
                            return LOADING_WAITING_LEVEL_UPDATE;
                        }
                        /* when probing PTS, take previous sequence number as reference if possible */
                        new_seqnum = Math.min(frag_previous.seqnum + 1, _levels[level].getLastSeqNumfromContinuity(frag_previous.continuity));
