Fix detection of incorrect number of commands