added locks to make the connection usable from mutliple Goroutines