Added code to assign the flight.err back to the error variable for error checking