[v6r12] Various bug fixes and/or better code in the accounting