diff --git a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py
index 2ec3a7b2d6dd4d09e7b9b05b57b14670e37afe60..f1da6a4c5930599973b9f18ad17e8b6f2a28fc9f 100644
--- a/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py
+++ b/tangostationcontrol/tangostationcontrol/statistics/writer/hdf5.py
@@ -120,9 +120,6 @@ class HDF5Writer(ABC):
         # grab the timestamp
         statistics_timestamp = statistics_packet.timestamp()
 
-        # query the device attributes for updated values
-        self.retrieve_attribute_values()
-
         # ignore packets with no timestamp, as they indicate FPGA processing was
         # disabled and are useless anyway.
         if statistics_packet.block_serial_number == 0:
@@ -173,6 +170,8 @@ class HDF5Writer(ABC):
         # write the finished (and checks if its the first matrix)
         if self.current_matrix is not None:
             try:
+                # query the device attributes for updated values
+                self.retrieve_attribute_values()
                 self.write_matrix()
             except Exception as e:
                 time = self.current_timestamp.strftime(
@@ -191,6 +190,7 @@ class HDF5Writer(ABC):
         # create a new and empty current_matrix
         self.current_matrix = self.new_collector()
         self.statistics_header = None
+        self.device_attributes = {}
 
     def write_matrix(self):
         """Writes the finished matrix to the hdf5 file"""