Kaepernick delivers, 49ers beat Packers 45-31