Fixed two crashes