avoid recompilation if null environment
add tests for #7 and closes #7