Fixed connection management issue