fixes and new unittests