integrate upstream
some fixes