some bug in flip and patch