Sync patch with what is suggested in upstream issue 178193018