fix a bug that get error cursor when in macro