Sync with commit cab40a0af989bf08302836f98e91672920369fa3
Now matches e0a32e62d9390f796feac6f5e1818323f970bbf5 completely.