diff --git a/src/categorizedaccountmodel.cpp b/src/categorizedaccountmodel.cpp
index 39d1de891b7e8cf459c1e6d4acc4676ecf3c6872..3ae34c3842ad28fda0ae48c58f123abc6f1e0a44 100644
--- a/src/categorizedaccountmodel.cpp
+++ b/src/categorizedaccountmodel.cpp
@@ -47,7 +47,7 @@ CategorizedAccountModel::~CategorizedAccountModel()
 
 QModelIndex CategorizedAccountModel::mapToSource(const QModelIndex& idx) const
 {
-   if (!idx.isValid() || !idx.parent().isValid())
+   if (!idx.isValid() || !idx.parent().isValid() || idx.model() != this)
       return QModelIndex();
    switch (idx.parent().row()) {
       case Categories::IP2IP:
@@ -55,7 +55,8 @@ QModelIndex CategorizedAccountModel::mapToSource(const QModelIndex& idx) const
          break;
       case Categories::SERVER: {
          const QModelIndex& ip2ipIdx = AccountListModel::instance()->ip2ip()->index();
-         return AccountListModel::instance()->index((ip2ipIdx.row() < idx.row())?idx.row()+1:idx.row(),0);
+         //TODO DHT: this will stop working
+         return AccountListModel::instance()->index((ip2ipIdx.row() <= idx.row())?idx.row()+1:idx.row(),0);
       }
          break;
       default:
@@ -65,6 +66,18 @@ QModelIndex CategorizedAccountModel::mapToSource(const QModelIndex& idx) const
    return QModelIndex();
 }
 
+QModelIndex CategorizedAccountModel::mapFromSource(const QModelIndex& idx) const
+{
+   if (!idx.isValid() || idx.model() != AccountListModel::instance())
+      return QModelIndex();
+
+   //TODO DHT: this will stop working
+   const QModelIndex& ip2ipIdx = AccountListModel::instance()->ip2ip()->index();
+   return idx.row() == ip2ipIdx.row()?index(0,0,index(Categories::IP2IP,0,QModelIndex())): (
+      index(idx.row()+(idx.row() > ip2ipIdx.row()?-1:0),0,index(Categories::SERVER,0,QModelIndex()))
+   );
+}
+
 QVariant CategorizedAccountModel::data(const QModelIndex& index, int role ) const
 {
    if (!index.isValid())
diff --git a/src/categorizedaccountmodel.h b/src/categorizedaccountmodel.h
index 6fd3708d772e6984fce431d63fefdb8be42df8a4..f74b7f30d6c5d804ef5d1cd85e0700c9d6a8cf8c 100644
--- a/src/categorizedaccountmodel.h
+++ b/src/categorizedaccountmodel.h
@@ -39,7 +39,8 @@ public:
    virtual QVariant headerData  (int section, Qt::Orientation orientation, int role           ) const;
 
    //Getter
-   QModelIndex mapToSource(const QModelIndex& idx) const;
+   QModelIndex mapToSource  (const QModelIndex& idx) const;
+   QModelIndex mapFromSource(const QModelIndex& idx) const;
 
 
 private: