bug fixes, sort function for sidebar