connection sample function correction