rebased patches for bug 760876