fixed too-long history length causing sequence repeat on loop