Fixing NULL pointer exception during preflight