fixed: sort and search functions