Fixed some crash issues.