correct the X and Y direction