fixed multithreading issue with lock strategy between UI and background threads