Fix some issues with mail queue.