chacned lookup in betree and fixed warnings