Avoid stack overflow calls to setXY