fix "where" and "having" formatting