Handle cases when not in environment

Fixes #1