Flow fixes and small bug fixes.