fix sort and scope