Added sanity checks for environment variables