Fix detector failing with longest runs at the beginning.