rebase patches for bug 760876 and more test fixes