diff --git a/sohstationviewer/view/ui/main_ui.py b/sohstationviewer/view/ui/main_ui.py
index 280e3798bbb97c37e98cee9df35767a2e4bd845a..a637aad5e50d7eb03ae947c918cd7c22255cfb7d 100755
--- a/sohstationviewer/view/ui/main_ui.py
+++ b/sohstationviewer/view/ui/main_ui.py
@@ -494,6 +494,14 @@ class UIMainWindow(object):
         background_group.addButton(self.background_black_radio_button)
         background_group.addButton(self.background_white_radio_button)
 
+        # For some reason, these button groups are deleted once they are out of
+        # scope, which causes the radio buttons they manage to be in the same
+        # group. This means that the sdata and data buttons are then also
+        # exclusive with the black and white background buttons. To fix the
+        # problem, we save the groups in the class so they don't get deleted.
+        self.data_group = data_group
+        self.background_group = background_group
+
         add_separation_line(left_layout)
 
         gap_layout = QHBoxLayout()