MOD: don't invert max and nbval, it creates stupid errors