Imported the workaround suggested by Marina Glancy in MDL-42946