fix pieceLength

fixed the pieceLength handling, per my interpretation of the documentation.