I removed that redundant block of code, but am getting the same issues. I also just learned that each time the page is redirected from confirm to paypal, the order actually goes through. Can you look at the file again and see if you see anything else? On line 422 there is a reference to sandbox, but changing that still doesn't help. I see in the address bar that the confirm page first starts to come in, then it's redirected.
Thanks,
Adam