Fix for needs() incorrect behavior

Moved the check to see if needs are met until after the command line flags are
processed so the check can see if an option is both defined and passed in by the
user. Added unit tests to cover fix as well.