-my ($json_root_pos, $root_aux_data) = get_json_move($pos, undef, $chld_in, $chld_out); # TODO: include previous hash if $includetransp == 0
-my $opening = $openings{$json_root_pos->{'opening_num'}} // 'A00: Start position';
+my ($json_root_pos, $root_aux_data);
+if ($includetransp) {
+ ($json_root_pos, $root_aux_data) = get_json_move($pos, undef, $chld_in, $chld_out);
+} else {
+ my $prev_pos_hash = 0;
+ if ($prevfen ne '') {
+ my $prevpos = Position->from_fen($prevfen);
+ my (undef, $prev_aux_data) = get_json_move($prevpos, undef, $chld_in, $chld_out);
+ $prev_pos_hash = $prev_aux_data->{'pos_hash'};
+ }
+ ($json_root_pos, $root_aux_data) = get_json_move($pos, $prev_pos_hash, $chld_in, $chld_out);
+}