Don't return message_stats if it's empty; similar to what the old DB did (if it is empty it will get JSONised as [] not {}).
merge bug25543 into stable