Fix for infinite fliping