Fixed error on disconnect

Fixes #26