Added env var check function, and minor fix for multiple sourcing.