Fix "Only run main thread" error.