detect file infomation more accurately
Merge pull request #256 from haiwen/patch-13

detect file infomation more accurately