WIP: a lot of progress in fixing the error and failures in test.