Back port various fixes