flipping bug fix