bugfix: use self.background_flag in background_thread not background_flag