Minor changes scripts
Fixed scripts to check if the environment variables are defined or not