Fixing bug in preflight code