Fixing bugs for cron