Fixed generation of y coordinate