btree: catch NULL value before it does harm