added extra check for file path