Fix and tests merged to core-8-5-branch and trunk.