Properly calculate the module states when upgrading

issue3518
review1871002
Set missing charset to MIME message on cron error

issue3522
review1951002
merge