Changed variable name

It made no sense. What was I thinking?
Increase "bad" counter when connection fails

Fixes bug #1
Fix indentation