merge fixes from the upstream repo