fix environments not working from cli
fix default environment value
environment tests
Merge pull request #564 from jenius/fix-environments

Fix environments