second attempt at fixing connection bug