add reconnection capability
make ag connections reconnect if connection lost
resolve merge conflict
Merge pull request #331 from teravest/take-care-of-db-closed-connections

Take care of db closed connections