fix directory check