Prevent messages from getting lost by adding a queue. Fixes #5431