Address pull request comments
Fix contract generation
Fix init-env code (observable by top-level bug)