Fix for issue #8023

Can someone code review.