Fixed plenty of bugs and crashes.