fix for cursor bug/forced disconnect

undefined breaking stuff, as usual
Merge pull request #171 from ThisIsNotAnUserName/patch-1

fix for cursor bug/forced disconnect