That's one of the problems. Multiple errors that include the carriage return character (but no line feed!) are printed to the screen, so you can't see what went wrong.
I actually got this solved; I'll post the code I used to troubleshoot it in a sec.