fixed array manipulation error in find_link_lengths