Fix tail flipping