fix bug with open connection