fixed spikes

re-added  len = all_thresh_cross.count() so the slicing in the
following if statement knows when to stop