Fix if condition in getopts.

While here, rename the cnt variable.