H-theorem and origins of instability in thermal lattice Boltzmann models