diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm
index a91c696b..effa405a 100644
--- a/PBot/Factoids.pm
+++ b/PBot/Factoids.pm
@@ -125,12 +125,14 @@ sub export_factoids {
my $table_id = 1;
foreach my $channel (sort keys %{ $self->factoids->hash }) {
+ next if not scalar keys %{ $self->factoids->hash->{$channel} };
my $chan = $channel eq '.*' ? 'global' : $channel;
- print FILE "$chan
\n";
+ print FILE "" . encode_entities($chan) . "
\n";
}
foreach my $channel (sort keys %{ $self->factoids->hash }) {
+ next if not scalar keys %{ $self->factoids->hash->{$channel} };
my $chan = $channel eq '.*' ? 'global' : $channel;
print FILE "\n";
print FILE "