connection count bug fix