fix the photo flipping bug