added check for file exist