Fix building queries with more than one parameter