Add first unit test

And fix a few issues for that :)