Fix some minor javascript bugs, improve saving connectors