Revert "fix the bug of the retreat function"

This reverts commit 3b6fb1442f617957f8441a2edac8d76ebdecddb4.