Arduino Leonardo Problem: I have to reset for sketch to work.

I am trying to create a device that needs to run the sketch when it is powered on without doing anything else. Right now my program works, but it needs to be manually reset after being powered on. I can’t figure out why this might be. I’ll attach my code below. If anyone knows why this might be happening I would really appreciate it.

Thank you!

#include <Event.h>
#include <Timer.h>

#include <avr/io.h>
#include <avr/wdt.h>

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
// pin #8 is IN from sensor (GREEN wire)
// pin #9 is OUT from arduino  (WHITE wire)
SoftwareSerial mySerial(8, 9);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
int getFingerprintIDez();
int access = 1;
const int light = 13;
const int RelayOn = 5;
const int RelayOn1 = 6;
const int OnPos = 11;
float start = 0;
float elapsed;
float timeoutS = 0;
float timeoutE;
long timer1;
long timer2;
long timer3;
int Enroll = 0;
void setup()  
{
  pinMode(RelayOn, OUTPUT);
  pinMode(RelayOn1, OUTPUT);
  pinMode(light, OUTPUT);
  
  Serial.begin(9600);
  Serial.println("fingertest");
  finger.begin(57600);

  if (finger.verifyPassword()) {

  } 
  else {
    Serial.println("Did not find fingerprint sensor :(.");
    digitalWrite(light, HIGH);
    while (1);
  }
  Serial.println("Waiting for valid finger...");
  
 
}

void loop()                     
{
//  while(access == 0){
//    digitalWrite(RelayOn, LOW);
//    digitalWrite(RelayOn1, LOW);
//    if(LUButtonState == LOW){
//    Serial.println(millis());
//    LUButtonState = digitalRead(LUButton);
//    delay(20);     //reset
//     }
//    
//    
//   else if(LUButtonState == HIGH){
//      delay(200);
//      LUButtonState = digitalRead(LUButton);
//      if(LUButtonState == HIGH){
//        timeoutS = millis();
//      access = 1;
//      delay(10);
//    }
//    }
//  }
  while(access == 1){
    getFingerprintIDez();
  }

  
  while(access == 2){
    BikeOn();
  }
  
}
//-------------------------------------------------------------------------------------------------------------------


void BikeOn(){
//  LUButtonState = digitalRead(LUButton);
//    if(LUButtonState == HIGH){
//    delay(200);
//    LUButtonState = digitalRead(LUButton);
//    if(LUButtonState == HIGH){
//    digitalWrite(RelayOn, LOW);
//    digitalWrite(RelayOn1, LOW);
//    access = 0;
//    delay(100);
//   }
//  }
//  else{
  
      digitalWrite(RelayOn, HIGH);
      digitalWrite(RelayOn1, HIGH);
//    }
  }
  


  


void Reset(){
  Serial.println("Reset");
     wdt_enable(WDTO_30MS);
     while(1) {};
      } 


int getFingerprintIDez() {
  Serial.println(timer3);
  timeoutE = millis();
  timer3 = timeoutE - timeoutS;
        if( timer3 >= 30000){
          access = 0;
          delay(20);
     }
 else{
          
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;

  // found a match!
  Serial.print("Found ID #"); 
  Serial.print(finger.fingerID); 
  Serial.print(" with confidence of "); 
  Serial.println(finger.confidence);
  if (finger.fingerID >=0){
    if(finger.fingerID <= 162){
      Serial.println("on");
      delay(200);
      timeoutS = 0;
      access = 2;
   }
  }   
 }
}
  Serial.begin(9600);
  Serial.println("fingertest");

On the Leonardo you have to wait for Serial to become available. eg.

  Serial.begin(9600);
  while (!Serial) { }    // <------- wait for Serial to become ready
  Serial.println("fingertest");

Is there any way to program this where it can function the same when there is no serial connection? The end device can't have a computer hooked up to it, but I'd like to be able to plug in a computer sometimes to see what it is doing(if it isn't working or something).

Edit: I just commented out this(and took out the "while (!Serial) { }" because I don't always have a serial connection) and it worked:

//  if (finger.verifyPassword()) {
//
//  } 
//  else {
//    Serial.println("Did not find fingerprint sensor :(.");
//    digitalWrite(light, HIGH);
//    while (1);
//  }
//  Serial.println("Waiting for valid finger...");
//  
//

One thing about this though is I don't really like giving up the error message for the sensor not being hooked up. Does anyone see something I can change to make it work rather than just getting rid of it? It isn't vital and I can definitely go without it if I need to though.
Also it takes about 5-6 seconds from when I give it power until the fingerprint scanner is active. Is this a normal amount of time for it to setup? or can I change something to make it faster?

A simple way of testing would be something like this:

Serial.begin(9600);
delay (5000);  // give serial time to start up
if (Serial)
  {
  // debugging prints

  }

Ah that makes sense, thank you!