More tests, fixes