fixed logic in max instance reducer