changing the way to deal with the fildes