Fixed many compile errors. Mainly around the breaking Collector api change in 5.0.