Corrected fid detection for output routine.