I haven't put it on the PDL mail-list - I didn't even know there was one! Thanks for pointing me to it.
Also, Thanks moritz for your suggestion. Thats a much better way than I was doing it. It works fine, but I'm still getting the same problem so it not fixed that. *sigh*