clear _data when freed
flush stdout for logging