Fixed concurrency bug in rendering thread.