Changed is_file method to use stat on file