Fix bug in NumberOfInvasionPath

The method did not perform right as it contained a small mistake in
its logic. This bug has been fixed, and the correct behavior has
been tested.