Jun, that worked. thanks! I still don't quite understand why, but as long as it works I guess I'm ok.
BTW, sorry about the missing line breaks in the code I posted above. For some reason on Mac OS X that happens sometimes when copying from a terminal window and pasting elsewhere, and I forgot to check for it before submitting.
If anyone thinks this would be a bad addition to static portlet speak up soon; otherwise it will go in with my next batch of bug fixes.