Fixed flipping bug