Fix tests and adapt to current code.