Fix the way that the input parameter nmax was interpreted