Some fixes, updated tests.