Fix crashes here and there