Fix bug with HAVING clause parameter counts