move path finding before we turn off stderr/stdout