fix sort error and add filter test