fixed wrong sorting direction