Some small fixes to BlockFlattening. All tests pass now.