fixed a big bunch of crashes!