bug fixing for cronjob