upstream fixes (patches from Arch)