added sync for standard output