Fixed error occuring in cron, to do with session usage