some fixes, warning: several unit tests still fail