Avoid sync issues with thread.