change template file to tempfile