Relabel method bug
#### Description
Relabel method bug in common classes
#### Steps/Code to Reproduce
```pycon
>>> from pycm import *
>>> actual = [1,0,0,0,1,2,0,2,1]
>>> predict = [1,0,1,1,1,2,0,2,0]
>>> cm = ConfusionMatrix(actual,predict)
>>> cm
pycm.ConfusionMatrix(classes: [0, 1, 2])
>>> cm.relabel({0:1,1:2,2:3})
```
#### Expected Behavior
Relabeling without error
#### Actual Behavior
```
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    cm.relabel({0:1,1:2,2:3})
  File "C:\Users\Sepkjaer\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pycm-2.7-py3.5.egg\pycm\pycm_obj.py", line 641, in relabel
    temp_dict[mapping[col]] = self.table[row][col]
KeyError: 0
```
#### Operating System
Windows 10
#### Python Version
Python 3.5.2
#### PyCM Version (Use : `pycm.__version__`)
2.7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f99166..2dcc4f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 ### Changed
 - Single class bug fixed
 - `CLASS_NUMBER_ERROR` error type changed to `pycmMatrixError`
+- `relabel` method bug fixed
 ## [2.7] - 2020-05-11
 ### Added
 - `average` method
diff --git a/Test/error_test.py b/Test/error_test.py
index eb899c6..b64050c 100644
--- a/Test/error_test.py
+++ b/Test/error_test.py
@@ -48,6 +48,10 @@ pycm.pycm_obj.pycmMatrixError: Mapping format error
 Traceback (most recent call last):
         ...
 pycm.pycm_obj.pycmMatrixError: Mapping class names error
+>>> cm.relabel({0:"L1",1:"L2",2:"L2"})
+Traceback (most recent call last):
+        ...
+pycm.pycm_obj.pycmMatrixError: Mapping class names error
 >>> cp = Compare([cm,cm])
 Traceback (most recent call last):
         ...
diff --git a/Test/overall_test.py b/Test/overall_test.py
index 5844818..21d6085 100644
--- a/Test/overall_test.py
+++ b/Test/overall_test.py
@@ -1381,4 +1381,16 @@ TPR(Sensitivity, recall, hit rate, or true positive rate)         1.0
 ['1', '~other~']
 >>> cm
 pycm.ConfusionMatrix(classes: ['1', '~other~'])
+>>> actual = [1,0,0,0,1,2,0,2,1]
+>>> predict = [1,0,1,1,1,2,0,2,0]
+>>> cm = ConfusionMatrix(actual,predict)
+>>> cm.relabel({0:1,1:2,2:3})
+>>> cm
+pycm.ConfusionMatrix(classes: [1, 2, 3])
+>>> cm.label_map[0]
+1
+>>> cm.label_map[1]
+2
+>>> cm.label_map[2]
+3
 """
diff --git a/pycm/pycm_obj.py b/pycm/pycm_obj.py
index 65addd3..7b51117 100644
--- a/pycm/pycm_obj.py
+++ b/pycm/pycm_obj.py
@@ -86,7 +86,7 @@ class ConfusionMatrix():
         self.sparse_matrix = None
         self.sparse_normalized_matrix = None
         self.positions = None
-        self.label_map = {x:x for x in self.classes}
+        self.label_map = {x: x for x in self.classes}
 
     def print_matrix(self, one_vs_all=False, class_name=None, sparse=False):
         """
@@ -634,6 +634,10 @@ class ConfusionMatrix():
             raise pycmMatrixError(MAPPING_FORMAT_ERROR)
         if set(self.classes) != set(mapping.keys()):
             raise pycmMatrixError(MAPPING_CLASS_NAME_ERROR)
+        if len(self.classes) != len(set(mapping.values())):
+            raise pycmMatrixError(MAPPING_CLASS_NAME_ERROR)
+        table_temp = {}
+        normalized_table_temp = {}
         for row in self.classes:
             temp_dict = {}
             temp_dict_normalized = {}
@@ -641,10 +645,10 @@ class ConfusionMatrix():
                 temp_dict[mapping[col]] = self.table[row][col]
                 temp_dict_normalized[mapping[col]
                                      ] = self.normalized_table[row][col]
-            del self.table[row]
-            self.table[mapping[row]] = temp_dict
-            del self.normalized_table[row]
-            self.normalized_table[mapping[row]] = temp_dict_normalized
+            table_temp[mapping[row]] = temp_dict
+            normalized_table_temp[mapping[row]] = temp_dict_normalized
+        self.table = table_temp
+        self.normalized_table = normalized_table_temp
         self.matrix = self.table
         self.normalized_matrix = self.normalized_table
         for param in self.class_stat.keys():
@@ -799,21 +803,28 @@ class ConfusionMatrix():
             raise pycmVectorError(VECTOR_ONLY_ERROR)
         if self.positions is None:
             classes = list(self.label_map.keys())
-            positions = {self.label_map[_class] : {'TP':[], 'FP':[], 'TN':[], 'FN':[]} for _class in classes}
-            [actual_vector, predict_vector] = vector_filter(self.actual_vector, self.predict_vector)
+            positions = {
+                self.label_map[_class]: {
+                    'TP': [],
+                    'FP': [],
+                    'TN': [],
+                    'FN': []} for _class in classes}
+            [actual_vector, predict_vector] = vector_filter(
+                self.actual_vector, self.predict_vector)
             for index, observation in enumerate(predict_vector):
                 for _class in classes:
+                    label = self.label_map[_class]
                     if observation == actual_vector[index]:
                         if _class == observation:
-                            positions[self.label_map[_class]]['TP'].append(index)
+                            positions[label]['TP'].append(index)
                         else:
-                            positions[self.label_map[_class]]['TN'].append(index)
+                            positions[label]['TN'].append(index)
                     else:
                         if _class == observation:
-                            positions[self.label_map[_class]]['FP'].append(index)
+                            positions[label]['FP'].append(index)
                         elif _class == actual_vector[index]:
-                            positions[self.label_map[_class]]['FN'].append(index)
+                            positions[label]['FN'].append(index)
                         else:
-                            positions[self.label_map[_class]]['TN'].append(index)
+                            positions[label]['TN'].append(index)
             self.positions = positions
         return self.positions
['pycm/pycm_obj.py', 'Test/error_test.py', 'Test/overall_test.py', 'CHANGELOG.md']