diff --git a/.dockerignore b/.dockerignore
index 677f96716c93178cfa0a7ac6d5e734e0a6b5c50a..e7a3e2ba09912a86bbea3e29975238def74f5c0a 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -4,3 +4,5 @@ docs
 build
 dist
 *.egg-info
+*.c
+*.h
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000000000000000000000000000000000..dfdb8b771ce07609491fa2e83698969fd917a135
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.sh text eol=lf
diff --git a/README.md b/README.md
index b8bc6fe499eb8ce73b74ee518acde96cbb78eb74..8e7db1ac454409b66b4ced335c0629dc6d61c5be 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,9 @@ Then copy your resulting wheel and install it via pip on the target system.
 ## v0.5.1
 
 * added `VarlenSeries.close_chunks`
+* `Database.sync` will now return 0
+* indexed-gzip proved to be a poor choice, dropped
+* `setup.py` fixed
 
 ## v0.5
 
diff --git a/requirements.txt b/requirements.txt
index 0f106c98ddb284aa46cebbd8e5441dba349f1522..08bdec7a22be249f116398bc7820e950927cb8f8 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,6 +2,5 @@ satella
 ujson
 snakehouse>=1.2.3
 six
-indexed_gzip
 nose2
 coverage
diff --git a/setup.py b/setup.py
index bb898a393a5552c5c5da460e18706436d0c56cf0..23daadd68c7d4ba45c0103a1bca87dc2d697961f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,11 @@
 import os
 import typing as tp
 
+from Cython.Build import cythonize
 from satella.files import find_files
 from distutils.core import setup
 
+from setuptools import find_packages, Extension
 from snakehouse import Multibuild, build, monkey_patch_parallel_compilation
 
 
@@ -20,15 +22,29 @@ if 'CI' in os.environ:
     ext_kwargs['define_macros'] = [("CYTHON_TRACE_NOGIL", "1")]
     directives.update(profile=True, linetrace=True, embedsignature=True)
     cythonize_kwargs['gdb_debug'] = True
-
+    # extensions = [
+    #     Extension('tempsdb.database', ['tempsdb/database.pyx']),
+    #     Extension('tempsdb.database', ['tempsdb/database.pyx']),
+    #     Extension('tempsdb.exceptions', ['tempsdb/exceptions.pyx']),
+    #     Extension('tempsdb.iterators', ['tempsdb/iterators.pyx']),
+    #     Extension('tempsdb.series', ['tempsdb/series.pyx']),
+    #     Extension('tempsdb.varlen', ['tempsdb/varlen.pyx']),
+    #     Extension('tempsdb.chunks.gzip', ['tempsdb/chunks/gzip.pyx']),
+    #     Extension('tempsdb.chunks.direct', ['tempsdb/chunks/direct.pyx']),
+    #     Extension('tempsdb.chunks.normal', ['tempsdb/chunks/normal.pyx']),
+    #     Extension('tempsdb.chunks.maker', ['tempsdb/chunks/maker.pyx']),
+    #     Extension('tempsdb.chunks.base', ['tempsdb/chunks/base.pyx']),
+    # ]
+    # ext_modules = cythonize(extensions, compiler_directives=directives)
+ext_modules = build([Multibuild('tempsdb', find_pyx('tempsdb'), **ext_kwargs), ],
+                     compiler_directives=directives,
+                     **cythonize_kwargs)
 
 setup(name='tempsdb',
-      version='0.5.1a2',
-      packages=['tempsdb'],
-      install_requires=['satella>=2.14.24', 'ujson', 'indexed_gzip'],
-      ext_modules=build([Multibuild('tempsdb', find_pyx('tempsdb'), **ext_kwargs), ],
-                        compiler_directives=directives,
-                        **cythonize_kwargs),
+      version='0.5.1',
+      packages=find_packages(include=['tempsdb', 'tempsdb.*']),
+      install_requires=['satella>=2.14.24', 'ujson'],
+      ext_modules=ext_modules,
       python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*',
       test_suite="tests",
       zip_safe=False
diff --git a/tempsdb/chunks/gzip.pyx b/tempsdb/chunks/gzip.pyx
index 0cca5b790eaf773edeb452edb0ec44019f78f826..553190986e9bba6ed7d91c6d2b21d317c01e03b4 100644
--- a/tempsdb/chunks/gzip.pyx
+++ b/tempsdb/chunks/gzip.pyx
@@ -1,5 +1,4 @@
 import gzip
-import indexed_gzip
 import threading
 
 
@@ -7,8 +6,8 @@ cdef class ReadWriteGzipFile:
     def __init__(self, path: str, compresslevel: int = gzip._COMPRESS_LEVEL_FAST):
         self.path = path
         self.compress_level = compresslevel
-        self.ro_file = indexed_gzip.IndexedGzipFile(path)
         self.rw_file = gzip.GzipFile(path, 'ab', compresslevel=self.compress_level)
+        self.ro_file = gzip.GzipFile(path, 'rb')
         self.pointer = 0
         self.lock = threading.RLock()
         self.needs_flush_before_read = False
@@ -19,8 +18,8 @@ cdef class ReadWriteGzipFile:
         self.size = self.pointer
 
     cpdef int flush(self) except -1:
-        self.rw_file.flush()
         self.ro_file.close()
+        self.rw_file.flush()
         self.ro_file = gzip.GzipFile(self.path, 'rb')
         self.pointer = 0
         self.needs_flush_before_read = False
diff --git a/tempsdb/database.pyx b/tempsdb/database.pyx
index c3969f997a621bc2bca5126b9edd4d5d99831da8..62c340c8fe8de673bf9e4f0fb7c963b2ae1d6ad3 100644
--- a/tempsdb/database.pyx
+++ b/tempsdb/database.pyx
@@ -194,6 +194,7 @@ cdef class Database:
         for series in self.open_series.values():
             if not series.closed:
                 series.sync()
+        return 0
 
     cpdef list get_all_normal_series(self):
         """