Added directory checks