fixed early variable reference to find length of piece_weights_history