Fix bugs in reader.
Add test for reader (change input file name)