a bug fix for set_XY