shuffle code in patches for bug 760876