fixed reading tempfile