use tempfile and remove print