fixed a lot of bugs
added query builder test