fixed small bug of new line when reading from a file