bugfixes: safelen should be initialized with len; amplitudes needs average search, not just end search