added line to check if search directory exists