prevent publicated IDs #3

prevents the creation of two identical IDs.
port of connections.js
small fixes