Add some checks for writeble dirs