Added fflush to stdout function