fix bug creating connection