add disconnection logic
Merge pull request #7 from tagular/fix/disconnect

add disconnection logic