fix the bug when maxWallNums < 5