Fix flakiness in ao tests