Merge fix for issue #24285 from 3.5