Fix bug in function definition of connect_sync