diff --git a/nomad_dos_fingerprints/plotting.py b/nomad_dos_fingerprints/plotting.py
index 04386e4928a81d44ac2996b79c8b56cbb6487f55..b606457125110e4bedf4f261bb4e8f04509982d2 100644
--- a/nomad_dos_fingerprints/plotting.py
+++ b/nomad_dos_fingerprints/plotting.py
@@ -17,7 +17,7 @@ def plot_FP_in_grid(byte_fingerprint, grid, show = True, label = '', axes = None
         else:
             width=abs(item[0]-plotgrid[index-1][0])
         for idx, dos_value in enumerate(item[1]):
-            if bin_fp[bit_position]==1 and (bin_fp[bit_position+1] == 0 or idx == len(item[1])-1):
+            if bin_fp[bit_position]==1 and (idx == len(item[1])-1 or bin_fp[bit_position+1] == 0 ):
                 x.append(item[0])
                 y.append(dos_value)
                 all_width.append(width)