Issue 2227 fix

Replace the old PR #2427