Fix the logic bug when assigning multiple attachment nodes