fix sort order bug and config