bug fixes (especially around counterwallet build system)