Fixed some misc crash-causing bugs
Other kibbles and bits that I can't recall :(