Fixed some things that might cause crashes.