included more checks for file access errors
Merge pull request #96 from etienneq/zero_filesize_bug

Separate file_exists() and filesize() checks to avoid fread and filesize error