def set_timer_interval(self):
        #if self.root.attributes("-topmost", True):
        #    self.root.attributes("-topmost", False)
        
        if not hasattr(self, 'current_session_timings'):  # Make sure the properties exist
            self.current_session_timings = []
            self.is_session_mode = False

        dialog = CustomTimeDialog(self.root, self.current_session_timings, self.is_session_mode)
        if dialog.result is not None:
            self.is_session_mode = dialog.togsess_mode.get()  # Ensure you're accessing the toggled state from the dialog

            if self.is_session_mode:
                self.current_session_timings = dialog.result
                # Session mode is active, dialog.result contains the list of session strings
                self.current_session_timings = dialog.result
                self.process_session(dialog.result)
                # Set the interval to the first session's time
                self.timer_interval = self.current_session_list[0][1] * 1000
                 
            else:
                # Session mode is inactive, dialog.result should be a numerical value 
                interval = dialog.result
                if interval < 1:  # Check if interval is less than 1 second
                    interval = 1
                self.timer_interval = interval * 1000  # Convert to milliseconds
                self.set_timer_interval = self.timer_interval
        else: 
            pass
        #self.root.lift()  # Bring the main window to the top
        self.root.focus_force()  # Give focus to the main window
        
        minutes = self.timer_interval // 60000
        seconds = (self.timer_interval % 60000) // 1000
        
        if self.timer_interval <=59000:
            self.timer_label.config(text=f"{seconds}")
        else :
            self.timer_label.config(text=f"{minutes:d}:{seconds:02d}")

    def next_image(self, event=None):
        if self.image_folder != "":
            if len(self.image_files) == len(self.history):
                self.history_index = (self.history_index + 1) % len(self.image_files)
            else:
                self.add_image_to_history()
            self.display_image()
                # Reset the timer interval to the stored set timer interval
       
        if self.is_session_mode:
            self.session_image_count -= 1
            if self.session_image_count <= 0:
                self.session_index = (self.session_index + 1) % len(self.current_session_list)
                self.session_image_count, interval = self.current_session_list[self.session_index]
                self.timer_interval = interval * 1000  # Setting the new interval from session
                self.set_timer_interval = interval * 1000

                print (self.session_image_count)
            else:
self.current_session_list[self.session_index]
                
                self.timer_interval = self.set_timer_interval #not reset

on first time initialisation, because self.session_image_count is 0 when  self.session_image_count -= 1 it doesnt play the first item on the list. how do i set the initial self.session_image_count to the first item before doing -=1 to it to make sure