Finish preparing for and fix bugs in env mode; print cfg in same order as defined.