Stop if doubling elements cannot be determined.

This should fix a couple "possibly uninitialized variable" warnings.