Fixed sorting for departments listing