add interface funtions for lattice class
fix some bugs in lattice class