work in progress. a few more unit tests has been fixed.