fix a bug in random walk