More tests, a few fixes