small fix to sorting logic of bar graphs