security check for dirs