Fixes #5878: Apply fix from #5874 to ncf's copy
Merge pull request #149 from jooooooon/bug_5878/apply_fix_from_5874_to_ncf_s_copy

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