fix sql, add sort by name