add existence check
debug flush()