fixed some bugs, added more checks, optimized code

- some checks were broken and resulted in openssl
  errors
- peculiarity of openssl 0.9.8 resulted in false
  errors during connection and therefore printed
  a connection error where everything was fine
- some more comments in the code to clarify it
- added the beginning of a better debug output
  if connection fails or openssl prints an error
- better regex grep for IP address
- new (colorful) notice if input is not fqdn