sync some patches with upstream