Fixed some crash problems.