Fix warnings and set agg method correctly