         Logger.debug("sequence \(sequence), timeout:\(timeout)")
         self.ioQueue.delay(timeout) {
             if sequence == self.writeSequence && self.writing {
-                self.writing = false
                 Logger.debug("timing out sequence=\(sequence), current writeSequence=\(self.writeSequence)")
                 self.didWrite(BCError.characteristicWriteTimeout)
             } else {

        Logger.debug("sequence \(sequence), timeout:\(timeout))")
        self.ioQueue.delay(timeout) {
            if sequence == self.readSequence && self._reading {
                self._reading = false
                Logger.debug("timing out sequence=\(sequence), current readSequence=\(self.readSequence)")
                self.readPromise.failure(BCError.characteristicReadTimeout)
            } else {
                Logger.debug("timeout expired")
            }

        self.service?.peripheral?.writeValue(value, forCharacteristic:self, type:type)
    }
    
    private func writeNext() {
        if self.writing == false && self.writeParameters.count > 0 {
            let parameters = self.writeParameters[0]
            self.writeParameters.removeAtIndex(0)
