Fixed bug with searching after sorting