Bugfix in disconnect subroutine.