fix concurrency issue with ui