Added check for file existance.