add missing functions and more unittests