fix to types in max function