fixed reading from file