Fix some crash issues.