Fixed another javascript error on race condition (again)