Some fixes after upstream commits