Fix crashes and add a hunk I forgot