Never mind, I was wrong.  It works fine if you move that statement up.