Added check for the directory