add this.counter properly in thread_ui.js