More tests and some fixes based on those.