diff --git a/minijson.pyx b/minijson.pyx
index fa54d2a15dffa36f305eae1cd42394386257b205..378752ecf200f9bf6e9640d677227a3c3768ad71 100644
--- a/minijson.pyx
+++ b/minijson.pyx
@@ -351,14 +351,14 @@ cpdef int dump(object data, cio: io.BytesIO) except -1:
             cio.write(b'\x05')
             cio.write(STRUCT_H.pack(data))
             return 3
-        elif -2147483648 <= data <= 2147483647:     # signed int, type 1
-            cio.write(b'\x01')
-            cio.write(STRUCT_l.pack(data))
-            return 5
         elif 0 <= data <= 0xFFFFFF:         # unsigned 3byte, type 12
             cio.write(b'\x0C')
             cio.write(STRUCT_L.pack(data)[1:])
             return 4
+        elif -2147483648 <= data <= 2147483647:     # signed int, type 1
+            cio.write(b'\x01')
+            cio.write(STRUCT_l.pack(data))
+            return 5
         elif 0 <= data <= 0xFFFFFFFF:       # unsigned int, type 4
             cio.write(b'\x04')
             cio.write(STRUCT_L.pack(data))
diff --git a/setup.py b/setup.py
index 45111ee510560b929b963ab79397c74c7a880089..483866977b8af3bd199ef42152708a4ad8ec5f50 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,9 @@
 import os
-from distutils.core import setup
 from distutils.extension import Extension
 
 from Cython.Build import cythonize
 from Cython.Compiler.Options import get_directive_defaults
+from distutils.core import setup
 
 directive_defaults = get_directive_defaults()
 directive_defaults['language_level'] = '3'