Fix xbdim<->xdim error. Fix /0 bug spike at xr = 0 zr = 0