fixed two crashes