Max is maxv. Probably why you are getting the error.