Fix crash bugs.