The algorithm incorrectly identifies the type of the piece the player promoted their pawn to if the pawn promotion is done with a capture of an enemy piece. This does not happen in the game as it is being detected, but the PGN is recording the piece type that was captured by the pawn as the promoting piece type.