Increment tries before trying to connect

Fixes #415.