Fixes #5878: Apply fix from #5874 to ncf's copy