fix error checking in multigroup function