Fixed the overlapping unit bug.