Fixes Connection for LibNeubot 3.1

In these patches I fixed some bugs to the Connection module, found out using the regression tests.