debugging latent type sampling. seems quite close.