Some fixes in connect-method