This fixes #4763 for the 2.5 branch.