Corrected directory check
Change from galatica
Fixed merge