Fixed bug with properly setting connection.