Fix a logical bug when setting async/sync mode.