There we go. Finally figured it out. It was because the lengths were sometimes zero.