fixed potential file read leak