fix group_limit in as_sql