added the check for input directory.