Many fixes from functional testing.