fix max_grade initialisation

During the SORM initialisation process, max_grade can become null or
0. Both values need to be catched and transformed to 1.