Fix revert sorting