updated cron job to work properly