Mostly tests and a small fix.