fix reading from file