Fix crash due to asynchronicity