fixed bugs in lua interface