Fixed bug in auto-dir detection.