More changes to help with running as a cron