Fixed connecting bug with both client-side and server-side