Slightly modified patch accepted. Now on trunk.

Thanks for the report and the fix.