Sync from 1.8 branch