reading from a file quite fragile