fix sorting scripts