diff --git a/setup.py b/setup.py
index 826957ff4077ef4099094c03599db32d6a0bd46c..ad95479415e00debfec5bcdb4a2c45219c148969 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@ if 'CI' in os.environ:
 
 
 setup(name='tempsdb',
-      version='0.5a1',
+      version='0.5a2',
       packages=['tempsdb'],
       install_requires=['satella>=2.14.24', 'ujson'],
       ext_modules=build([Multibuild('tempsdb', find_pyx('tempsdb')), ],
diff --git a/tempsdb/chunks.pyx b/tempsdb/chunks.pyx
index 3d3066a08d09fd875e9932d8db535d4316c63938..31f2a235c758b2c184d7c0fbab60c2edfebeefd9 100644
--- a/tempsdb/chunks.pyx
+++ b/tempsdb/chunks.pyx
@@ -140,8 +140,8 @@ cdef class Chunk:
 
     cdef int decref(self) except -1:
         if self.parent is not None:
-            self.parent.decref_chunk(self.min_ts)
-            if self.parent.refs_chunks[self.name()] < 0:
+            self.parent.decref_chunk(self.name())
+            if self.parent.get_references_for(self.name()) < 0:
                 raise ValueError('reference of chunk fell below zero!')
         return 0
 
@@ -407,7 +407,7 @@ cdef class Chunk:
         cdef unsigned long long name = self.name()
         if self.parent:
             with self.parent.open_lock:
-                if not force and self.parent.refs_chunks.get(name, 0) > 0:
+                if not force and self.parent.get_references_for(name) > 0:
                     raise StillOpen('this chunk is opened')
                 del self.parent.refs_chunks[name]
                 del self.parent.open_chunks[name]
diff --git a/tempsdb/series.pyx b/tempsdb/series.pyx
index a6905e8dd26141904f601b57fb9e7df398cf9155..fced5eab089672bceaf8c1cedab003b28226c45b 100644
--- a/tempsdb/series.pyx
+++ b/tempsdb/series.pyx
@@ -204,7 +204,7 @@ cdef class TimeSeries:
                     while len(self.chunks) >= 2 and timestamp > self.chunks[1]:
                         chunk_to_delete = self.chunks[0]
                         if chunk_to_delete in self.open_chunks:
-                            refs = self.refs_chunks.get(chunk_to_delete, 0)
+                            refs = self.get_references_for(chunk_to_delete)
                             if not refs:
                                 self.open_chunks[chunk_to_delete].delete()
                             else:
@@ -378,7 +378,7 @@ cdef class TimeSeries:
             for chunk_name in chunks:
                 if chunk_name == last_chunk_name:
                     continue
-                elif not self.refs_chunks.get(chunk_name, 0):
+                elif not self.get_references_for(chunk_name):
                     self.open_chunks[chunk_name].close()
                     try:
                         del self.refs_chunks[chunk_name]