Fixed bug in connection