diff --git a/C/tracer.c b/C/tracer.c
index f2a70a169..0c2c9c9bf 100644
--- a/C/tracer.c
+++ b/C/tracer.c
@@ -161,13 +161,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
LOCK(Yap_heap_regs->low_level_trace_lock);
sc = Yap_heap_regs;
vsc_count++;
- if (B->cp_tr < B->cp_b->cp_tr || TR < B->cp_tr)
- fprintf(stderr,"Here we go %lld\n", vsc_count);
- if (vsc_count < 13600)
- {
- UNLOCK(Yap_heap_regs->low_level_trace_lock);
- return;
- }
#ifdef COMMENTED
if (worker_id != 04 || worker_id != 03) return;
// if (vsc_count == 218280)
diff --git a/changes-5.1.html b/changes-5.1.html
index 8d531e6fd..ceaac5273 100644
--- a/changes-5.1.html
+++ b/changes-5.1.html
@@ -16,7 +16,9 @@
Yap-5.1.2:
-- FIXED: make 128 maximum disjunction depth.
+- FIXED: avl_new/1 (obs from Miguel Filgueiras).
+- FIXED: broken all/3 (obs from Miguel Filgueiras).
+- FIXED: make 128 maximum disjunction depth (obs from Nicos Angelopoulos).
- FIXED: first cut at using timestamps with logical updates.
- FIXED: indexing on doubles wasn't working properly.
- FIXED: sending large lists of atomics to DB was very, very slow.
diff --git a/docs/yap.tex b/docs/yap.tex
index 0011a2586..a7ec111d6 100644
--- a/docs/yap.tex
+++ b/docs/yap.tex
@@ -7115,7 +7115,13 @@ insert and lookup elements in the tree. Please try red-black trees if
you need deletion.
@table @code
-@item avl_insert(+@var{Key},?@var{Value},+@var{T0},+@var{TF})
+@item avl_new(+@var{T})
+@findex avl_new/1
+@snindex avl_new/1
+@cnindex avl_new/1
+Create a new tree.
+
+@item avl_insert(+@var{Key},?@var{Value},+@var{T0},-@var{TF})
@findex avl_insert/4
@snindex avl_insert/4
@cnindex avl_insert/4
diff --git a/library/avl.yap b/library/avl.yap
index a0ec8e2c6..17288656b 100644
--- a/library/avl.yap
+++ b/library/avl.yap
@@ -16,10 +16,13 @@
*************************************************************************/
:- module(avl, [
+ avl_new/1,
avl_insert/4,
avl_lookup/3
]).
+avl_new([]).
+
avl_insert(Key, Value, T0, TF) :-
insert(T0, Key, Value, TF, _).
diff --git a/pl/setof.yap b/pl/setof.yap
index 4d9ac2844..a876c3dfd 100644
--- a/pl/setof.yap
+++ b/pl/setof.yap
@@ -189,6 +189,7 @@ all(T,G,S) :-
% $$set does its best to preserve space
'$$set'(S,R) :-
'$$build'(S0,_,R),
+ S0 = [_|_],
S = S0.
'$$build'(Ns,S0,R) :- '$db_dequeue'(R,X), !,