Skip commands that have incorrect number of arguments

Partially fix #2391 by validating that each command has the expected number of arguments and skipping commands that do not validate.