Upstream changes from ChRIS.