I see that you have updated the description of this issue. Did you have a chance to look at the patch I attached? I'm I on the right track...? (The patch is old, so there's probably not much point in applying it, but if the basic idea is OK, I can create a new one).
-- dt However, experience shows that for many people and many applications a dose of paranoia is reasonable - Bjarne Stroustrup
