Critical temperature of a Bose gas in an optical lattice