Fix crashes and stuff