better error message for when kl is None or NaN