Fixed hang of InvokeOnMainThread.