Frege and Hilbert on consistency