refactor with file::stat