More tests and some fixes.