Replace zero comparison with error threshold.

This seems to fix an issue with multiple segments being returned instead
of a single threshold.