Fix #1080
Fix a flaky test