Bugfix: Connect failed occurs due to prepareConnect() being called prematurely