More tests, and some code path fixes

Hopefully, all is in order now. Final tests will tell.