Fix bug in email cronjob