fixing call to sys.stdout