Fixed missing chain in HAVING