Possible fix. Note, this is built on top of changes submitted in bug 440.