Add some tests + fixes.