add file exists check.