use len(data) instead of self.payloadLength