Underpromotion Puzzle

The second-to-last move is unfortunately flawed.
Also, I believe this is a variation on another puzzle I have seen with a very similar solution.

Ha! Ha! It's a funny puzzle! All the move are forced in fact. It's like a mechanical machine!
Just for fun, I entered that in Chessmaster 9000 and see if it can solve it and yes, it solved it. I was curious to see if their algorithm would promote as knight since it was what is required to avoid a stalemate.
Thanks for sharing!
The second-to-last move is unfortunately flawed.
Also, I believe this is a variation on another puzzle I have seen with a very similar solution.
The 12th move is a8=B, not a8=Q. And I did use ideas from a book I read 2 years ago.