Fixed crash due to multi thread access #660 #670