fix lock
main thread support