Bug fix in cron script