Fix bug where $x1 and $y1 are undefined