Fix message delivery bug