diff --git a/src/bot.ts b/src/bot.ts
index ce138ac0b3452add95c61bdd8c29b4478729ba03..65e60a161e7480913b25f3c8039cc096dfdca3cb 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -251,6 +251,7 @@ export class DiscordBot {
         });
         client.on("message", async (msg: Discord.Message) => {
             try {
+                log.verbose(`Got incoming msg i:${msg.id} c:${msg.channel.id} g:${msg.guild?.id}`);
                 MetricPeg.get.registerRequest(msg.id);
                 await this.channelLock.wait(msg.channel.id);
                 this.clientFactory.bindMetricsToChannel(msg.channel as Discord.TextChannel);
@@ -382,7 +383,7 @@ export class DiscordBot {
                 this.ClientFactory.bindMetricsToChannel(channel as Discord.TextChannel);
                 const lookupResult = new ChannelLookupResult();
                 lookupResult.channel = channel as Discord.TextChannel;
-                lookupResult.botUser = this.BotUserId === client.user?.id;
+                lookupResult.botUser = this.bot.user?.id === client.user?.id;
                 lookupResult.canSendEmbeds = client.user?.bot || false; // only bots can send embeds
                 return lookupResult;
             }
@@ -898,7 +899,7 @@ export class DiscordBot {
             return; // Skip *our* messages
         }
         const chan = msg.channel as Discord.TextChannel;
-        if (msg.author.id === this.BotUserId) {
+        if (msg.author.id === this.bot.user?.id) {
             // We don't support double bridging.
             log.verbose("Not reflecting bot's own messages");
             MetricPeg.get.requestOutcome(msg.id, true, "dropped");
diff --git a/src/clientfactory.ts b/src/clientfactory.ts
index 0289bc387933046930029053aff88f55dda07256..149e562bade81175655ba6d52f18828a7f683970 100644
--- a/src/clientfactory.ts
+++ b/src/clientfactory.ts
@@ -44,8 +44,16 @@ export class DiscordClientFactory {
             messageCacheLifetime: 5,
         });
 
+        const waitPromise = new Promise((resolve, reject) => {
+            this.botClient.once("shardReady", resolve);
+            this.botClient.once("shardError", reject);
+        });
+
         try {
             await this.botClient.login(this.config.botToken, true);
+            log.info("Waiting for shardReady signal");
+            await waitPromise;
+            log.info("Got shardReady signal");
         } catch (err) {
             log.error("Could not login as the bot user. This is bad!", err);
             throw err;
diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts
index c3df5ffeba4117e644101b274ac6c5e284b6d326..3a0af9548e0cef50aba399074830c5d28eaee04f 100644
--- a/src/matrixeventprocessor.ts
+++ b/src/matrixeventprocessor.ts
@@ -223,7 +223,6 @@ export class MatrixEventProcessor {
 
     public async ProcessStateEvent(event: IMatrixEvent) {
         log.verbose(`Got state event from ${event.room_id} ${event.type}`);
-        const channel = await this.discord.GetChannelFromRoomId(event.room_id) as Discord.TextChannel;
 
         const SUPPORTED_EVENTS = ["m.room.member", "m.room.name", "m.room.topic"];
         if (!SUPPORTED_EVENTS.includes(event.type)) {
@@ -279,6 +278,7 @@ export class MatrixEventProcessor {
         }
 
         msg += " on Matrix.";
+        const channel = await this.discord.GetChannelFromRoomId(event.room_id) as Discord.TextChannel;
         await this.discord.sendAsBot(msg, channel, event);
         await this.sendReadReceipt(event);
     }