make rebase more robust to failures