fixed readdir and readfromfile