add printfflush() after ever iteration of printf of debug information.