fixing bug in Plug.connect