Fix default query string
Fix some problems reported by clang