Fixing bug in readfile