Fix for bug where messages are stuck in pending state after upgrade.