lambda1@tg says to YSITD
you need to assume g is continuous on the interval [a, b]