Upstream changes done in bug 877302