attempting to fix ending mode swtich