Check if file exists before checking contents - fix #432