I'm not 100% sure I understand what changes you're suggesting but the attached patch does what I think you're after. Is that what you had in mind?Looks good.
Thanks. I just committed it to trunk but forgot to ask for approval to backport it to 6 and 5. Martin