Fix tests, fix one bug