Improve robustness of flip