Fix crash issues