fixed the flipping of x and y