fix type error for max field