Fix: deadlock because left and right loops iterate different numbers of times.