minor errors fixed with directory creation and checks