Corrected pieceCount bugs