Add additional validity check in flip
Add test to compare with scipy