Fixed a performance issue and a synchronization issue.