add new tests, fix problems with perform query and other minor changes