Fixed two small bugs, continuing work on AVL db