cleanup and fixed begin in sendPiece