query thing and some bugfix