last unit tests and fixes