Implementing fix for Issue #6696

This will fix the exact issue addressed in 6696, however, there may be other cases which this does not fix.