Fix connection lock, removed unused