Fixed issue with default "~" character. Replaced to env HOME.

Signed-off-by: Daniel (dmilith) Dettlaff <dmilith@verknowsys.com>
Implemented reconnection retries and fixed segfault.

Signed-off-by: Daniel (dmilith) Dettlaff <dmilith@verknowsys.com>