diff --git a/libmat2/torrent.py b/libmat2/torrent.py
index d614136d6a4ce196c23571831ca55f57ad839366..925ac55c2be89da3243e40545b5198f1340aa4b6 100644
--- a/libmat2/torrent.py
+++ b/libmat2/torrent.py
@@ -60,8 +60,6 @@ class _BencodeHandler(object):
     def __decode_int(s: bytes) -> Tuple[int, bytes]:
         s = s[1:]
         next_idx = s.index(b'e')
-        if next_idx is None:
-            raise ValueError  # missing suffix
         if s.startswith(b'-0'):
             raise ValueError  # negative zero doesn't exist
         elif s.startswith(b'0') and next_idx != 1:
@@ -70,16 +68,13 @@ class _BencodeHandler(object):
 
     @staticmethod
     def __decode_string(s: bytes) -> Tuple[bytes, bytes]:
-        sep = s.index(b':')
-        if set is None:
-            raise ValueError  # missing suffix
-        str_len = int(s[:sep])
-        if str_len < 0:
-            raise ValueError
-        elif s[0] == b'0' and sep != 1:
+        colon = s.index(b':')
+        str_len = int(s[:colon])
+        print('S: %s' % s)
+        if s[0] == '0' and colon != 1:
             raise ValueError
         s = s[1:]
-        return s[sep:sep+str_len], s[sep+str_len:]
+        return s[colon:colon+str_len], s[colon+str_len:]
 
     def __decode_list(self, s: bytes) -> Tuple[list, bytes]:
         r = list()
diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py
index 776b0e9f4dde54dbb5ae4863c2c97bc542acaa2b..a77acbc23befdff66e3a14cfbac40b15e9d906af 100644
--- a/tests/test_corrupted_files.py
+++ b/tests/test_corrupted_files.py
@@ -54,6 +54,26 @@ class TestCorruptedFiles(unittest.TestCase):
         with self.assertRaises(ValueError):
             torrent.TorrentParser('./tests/data/clean.torrent')
 
+        with open("./tests/data/clean.torrent", "w") as f:
+            f.write("i-0e")
+        with self.assertRaises(ValueError):
+            torrent.TorrentParser('./tests/data/clean.torrent')
+
+        with open("./tests/data/clean.torrent", "w") as f:
+            f.write("i00e")
+        with self.assertRaises(ValueError):
+            torrent.TorrentParser('./tests/data/clean.torrent')
+
+        with open("./tests/data/clean.torrent", "w") as f:
+            f.write("d01:AAAAAAAAA")
+        with self.assertRaises(ValueError):
+            torrent.TorrentParser('./tests/data/clean.torrent')
+
+        with open("./tests/data/clean.torrent", "w") as f:
+            f.write("1:aaa")
+        with self.assertRaises(ValueError):
+            torrent.TorrentParser('./tests/data/clean.torrent')
+
         os.remove('./tests/data/clean.torrent')
 
     def test_odg(self):