fix issue with opening new connections when methods are called from other methods