fixed issues with sorting and searching