closed #2748: Fixed some bugs about flip.