Fix seg fault in lattice samples