         let newData = Data(byteValue: value)
         
         // validate application errors with write callback
-        if let error = willWrite?(UUID: attribute.UUID, value: attribute.value, newValue: (newData, newData, 0)) {
+        if let error = willWrite?(UUID: attribute.UUID, value: attribute.value, newValue: newData) {
             
             doResponse(errorResponse(opcode, error, handle))
             return

            
        case .Write:
            
            var newValues = [Data](repeating: Data(), count: preparedWrites.count)
            
            // validate
            for (index, write) in preparedWrites.enumerated() {
                
                let attribute = database[write.handle]
                
                let newData = prepareNewValue(currentValue: attribute.value.byteValue, newBytes: write.value, offset: write.offset)
                
                // validate application errors with write callback
                if let error = willWrite?(UUID: attribute.UUID, value: attribute.value, newValue: (Data(byteValue: newData), Data(byteValue: write.value), Int(write.offset))) {
                    
                    errorResponse(opcode, error, write.handle)
                    return
                }
                
                newValues[index] = Data(byteValue: newData)
            }
            
            // write
            for (index, write) in preparedWrites.enumerated() {
                
                let newValue = newValues[index]
                
                database.write(newValue, forAttribute: write.handle)
            }
            
        case .Cancel: break // queue always cleared

        respond(response)
    }
    
    private func executeWriteRequest(pdu: ATTExecuteWriteRequest) {
        
        let opcode = pdu.dynamicType.attributeOpcode
        
