fix for slow iostreams, set buffer for cout