Fixed bug that broke the sorting functionality.