Add crash fix from thread issue