add tests and small fixies