Fixed issue: Added missed connection check
Merge pull request #348 from sergeyklay/master

Missed connection check