Note that I committed and pushed the fixes for this issue for 5.0 using HHH-9446. See the master commits there for details.