Fixed multithreading runtime issue.