switch to unformatted if data is null, and sanitize unformatted output