added check to ensure env vars are set