Fixed error when output_fp was not None.