fixed flipped bug