patches for bug 826798 and bug 827083